<template>
  <div class="min-h-screen bg-gray-50">
    <navigation></navigation>
    
    <div class="max-w-7xl mx-auto px-4 py-20">
      <!-- 顶部信息栏 -->
      <div class="flex justify-between items-center mb-8">
        <div class="flex space-x-2">
          <a href="http://localhost:5173/modifiedInformation"> 
          <img 
  src="/src/assets/img/11.jpeg" 
  style="height: 100px; width: auto; border-radius: 50%;"
>
          </a>
          <div style="margin-left: 30px;">
            <h1 class="text-xl font-bold text-gray-800">姓名：罗峰</h1>
             <h1 class="text-xl font-bold text-gray-800">年龄：24</h1>
              <h1 class="text-xl font-bold text-gray-800">学历：本科</h1>
          </div>
        </div>
        <button 
          @click="handleSignIn"
          class="flex items-center bg-gradient-to-r from-blue-100 to-blue-50 px-4 py-2 rounded-full shadow-inner hover:from-blue-200 hover:to-blue-100 transition-colors cursor-pointer"
        >
          <span class="text-blue-600 font-medium">签到</span>
          <span class="mx-2 text-gray-500">|</span>
          <span class="text-blue-800">已连续签到 {{ signInDays }} 天</span>
          <span v-if="!signedInToday" class="ml-2 bg-blue-600 text-white px-2 py-1 rounded-full text-xs">+5 积分</span>
          <span v-else class="ml-2 bg-gray-300 text-gray-600 px-2 py-1 rounded-full text-xs">已签到</span>
        </button>
      </div>

      <!-- 弹窗 -->
      <el-dialog
        v-model="signInDialogVisible"
        width="380px"
        :show-close="false"
        center
        class="signin-dialog"
      >
        <!-- 添加自定义header -->
        <template #header>
          <div class="dialog-header relative">
            <span class="text-gray-600 text-lg">每日签到</span>
            <button 
              @click="signInDialogVisible = false"
              class="close-btn absolute right-0 top-1/2 -translate-y-1/2 text-xl text-gray-400 hover:text-gray-600 transition-colors"
            >
              ×
            </button>
          </div>
        </template>

        <div class="text-center py-4">
          <!-- 删除原来的"每日签到"标题 -->
          
          <!-- 实时日期（大字体） -->
          <p class="text-3xl font-medium text-gray-800 my-4">
            {{ currentDate }}
          </p>
          
          <!-- 连续签到天数 -->
          <p class="text-gray-500 text-base mb-6">
            已连续签到 <span class="text-blue-500 font-medium">{{ signInDays }}</span> 天
          </p>
          
          <!-- 立即签到按钮 -->
          <!-- 第四行：立即签到按钮 -->
          <el-button 
            v-if="!signedInToday"
            type="primary" 
            size="large" 
            class="w-full mb-4"
            @click="handleSignIn"
          >
            立即签到
          </el-button>
          <el-button 
            v-else
            type="info" 
            size="large" 
            class="w-full mb-4"
            disabled
          >
            今日已签到
          </el-button>
          
          <!-- 今日可获得积分 -->
          <div class="border border-gray-200 rounded-lg p-3 mb-6">
            <div class="flex items-center justify-center">
              <el-icon class="text-yellow-500 mr-1"><Money /></el-icon>
              <span class="text-gray-700">今日可获得 <span class="text-blue-500 font-medium">5</span> 积分</span>
            </div>
          </div>
          
          <!-- 底部链接 -->
          <div class="flex justify-between text-sm text-gray-500">
            <a href="#" class="hover:text-blue-500 " @click.prevent="showSignRecord">签到记录</a>
            <span>|</span>
            <a href="#" class="hover:text-blue-500" @click.prevent="goToPointsMall">积分商城</a>
          </div>
        </div>
      </el-dialog>

      <!-- 主要内容区域 - 调整为两栏布局 -->
      <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
        <!-- 左侧栏 -->
        <div class="space-y-6">
          <!-- 获奖证书 -->
          <div class="bg-white rounded-xl shadow-md overflow-hidden border border-gray-100">
            <div class="p-5 border-b border-gray-100 flex justify-between items-center">
              <div class="flex items-center">
                <img src="/src/assets/img/111.png" style="width: 20px; height: 20px; margin-right: 10px;" >
                <h2 class="text-lg font-semibold text-gray-800 ">获奖证书</h2>
              </div>
              <router-link 
                to="/certificateAuthority/competition" 
                class="text-blue-500 hover:text-blue-700 text-sm flex items-center"
              >
                查看更多 <el-icon class="w-4 h-4 ml-1"><ArrowRight /></el-icon>
              </router-link>
            </div>
            <div class="p-5 space-y-4">
              <div class="flex flex-col gap-1 p-3 hover:bg-gray-50 rounded-lg relative">
              <div style="display: flex;">
                <h3 class="font-medium text-gray-800">前端开发工程师认证</h3>
                 <img src="/src/assets/img/正确.png" style="width: 20px; height: 20px; margin-left: 20px;">
                 </div>
                <p class="text-sm text-gray-500">专业技能认证中心</p>
                <p class="text-xs text-gray-400 mt-1">2023-12-15</p>
              
              </div>
              
              <div class="flex flex-col gap-1 p-3 hover:bg-gray-50 rounded-lg relative">
              <div style="display: flex;">
                <h3 class="font-medium text-gray-800">Web全栈开发证书</h3>
                 <img src="/src/assets/img/正确.png" style="width: 20px; height: 20px; margin-left: 20px;">
                </div>
                <p class="text-sm text-gray-500">互联网技术学院</p>
                <p class="text-xs text-gray-400 mt-1">2023-10-20</p>
              </div>
              
              <div class="flex flex-col gap-1 p-3 hover:bg-gray-50 rounded-lg relative">
                <div style="display:flex;">
                <h3 class="font-medium text-gray-800">UI/UX设计认证</h3>
                 <img src="/src/assets/img/正确.png" style="width: 20px; height: 20px; margin-left: 20px;">
               </div>
                 <p class="text-sm text-gray-500">设计师协会</p>
                <p class="text-xs text-gray-400 mt-1">2023-08-05</p>
               
              </div>
            </div>
          </div>

          <!-- 我的项目 -->
          <div class="bg-white rounded-xl shadow-md overflow-hidden border border-gray-100">
            <div class="p-5 border-b border-gray-100 flex justify-between items-center">
              <div class="flex items-center">
                <img src="/src/assets/img/项目.png" style="width: 20px; height: 20px;margin-right: 10px;">
                <h2 class="text-lg font-semibold text-gray-800">我的项目</h2>
              </div>
              <router-link 
                to="/certificateAuthority/projects" 
                class="text-blue-500 hover:text-blue-700 text-sm flex items-center"
              >
                查看更多 <el-icon class="w-4 h-4 ml-1"><ArrowRight /></el-icon>
              </router-link>
            </div>
            <div class="p-5 space-y-4">
              <div class="border border-gray-100 rounded-lg p-4 hover:shadow-md transition-shadow">
                <h3 class="font-medium text-gray-800">在线教育平台</h3>
                <p class="text-sm text-gray-500 mt-2">基于Vue3和Spring Boot的在线教育平台</p>
                <div class="flex flex-wrap gap-2 mt-2">
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Vue3</span>
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Spring Boot</span>
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">在线教育</span>
                </div>
                 <p class="text-sm text-green-500 mt-2">项目成果：性能提升40%</p>
              </div>
              
              <div class="border border-gray-100 rounded-lg p-4 hover:shadow-md transition-shadow">
                <h3 class="font-medium text-gray-800">电商管理系统</h3>
                <p class="text-sm text-gray-500 mt-2">基于React和Node.js的电商后台管理系统</p>
                <div class="flex flex-wrap gap-2 mt-2">
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">React</span>
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Node.js</span>
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">电商系统</span>
                </div>
                <p class="text-sm text-green-500 mt-2">项目成果：服务超过100家企业</p>
              </div>
            </div>
          </div>
        </div>

        <!-- 右侧栏 -->
        <div class="space-y-6">
          <!-- 通用技能 -->
          <div class="bg-white rounded-xl shadow-md overflow-hidden border border-gray-100">
            <div class="p-5 border-b border-gray-100 flex justify-between items-center">
              <div class="flex items-center">
                <img src="/src/assets/img/空五角星.png" style="width: 20px; height: 20px;margin-right: 10px;">
                <h2 class="text-lg font-semibold text-gray-800">通用技能</h2>
              </div>
              <router-link 
                to="/certificateAuthority/skills" 
                class="text-blue-500 hover:text-blue-700 text-sm flex items-center"
              >
                查看更多 <el-icon class="w-4 h-4 ml-1"><ArrowRight /></el-icon>
              </router-link>
            </div>
            <div class="p-5 space-y-4">
              <div>
                <div class="flex justify-between items-center mb-1">
                  <h3 class="text-sm font-medium text-gray-700">前端开发</h3>
                    <img src="/src/assets/img/正确.png" style="width: 20px; height: 20px; margin-left: 20px;">
                </div>
                <el-progress :percentage="90" :show-text="false" :stroke-width="6" color="#3b82f6" />
              </div>
              <div>
                <div class="flex justify-between items-center mb-1">
                  <h3 class="text-sm font-medium text-gray-700">UI设计</h3>
                   <img src="/src/assets/img/正确.png" style="width: 20px; height: 20px; margin-left: 20px;">
                </div>
                <el-progress :percentage="80" :show-text="false" :stroke-width="6" color="#3b82f6" />
              </div>
              <div>
                <div class="flex justify-between items-center mb-1">
                  <h3 class="text-sm font-medium text-gray-700">项目管理</h3>
                     <img src="/src/assets/img/正确.png" style="width: 20px; height: 20px; margin-left: 20px;">
                </div>
                <el-progress :percentage="75" :show-text="false" :stroke-width="6" color="#3b82f6" />
              </div>
            </div>
          </div>

          <!-- 实习经历 -->
          <div class="bg-white rounded-xl shadow-md overflow-hidden border border-gray-100">
            <div class="p-5 border-b border-gray-100 flex justify-between items-center">
              <div class="flex items-center">
                 <img src="/src/assets/img/实习经历.png" style="width: 20px; height: 20px;margin-right: 10px;">
                <h2 class="text-lg font-semibold text-gray-800">实习经历</h2>
              </div>
              <router-link 
                to="/certificateAuthority/internship-experience" 
                class="text-blue-500 hover:text-blue-700 text-sm flex items-center"
              >
                查看更多 <el-icon class="w-4 h-4 ml-1"><ArrowRight /></el-icon>
              </router-link>
            </div>
            <div class="p-5 space-y-4">
              <div class="flex flex-col gap-1 p-3 hover:bg-gray-50 rounded-lg">
                <div class="flex items-start">
                  <img src="/src/assets/img/公司.png" style="width: 20px; height: 20px;margin-right: 10px;">
                  <div>
                    <h3 class="font-medium text-gray-800">科技有限公司</h3>
                    <p class="text-sm text-gray-500">前端开发实习生</p>
                    <p class="text-xs text-gray-400">2023.06 - 2023.09</p>
                    <p class="text-sm text-gray-500 mt-1">参与企业级应用开发</p>
                  </div>
                </div>
              </div>
              
              <div class="flex flex-col gap-1 p-3 hover:bg-gray-50 rounded-lg">
                <div class="flex items-start">
                  <img src="/src/assets/img/公司.png" style="width: 20px; height: 20px;margin-right: 10px;">
                  <div>
                    <h3 class="font-medium text-gray-800">互联网科技公司</h3>
                    <p class="text-sm text-gray-500">UI设计实习生</p>
                    <p class="text-xs text-gray-400">2023.02 - 2023.05</p>
                    <p class="text-sm text-gray-500 mt-1">负责产品界面设计</p>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- 我的活动 -->
          <div class="bg-white rounded-xl shadow-md overflow-hidden border border-gray-100">
            <div class="p-5 border-b border-gray-100 flex justify-between items-center">
              <div class="flex items-center">
                 <img src="/src/assets/img/活动.png" style="width: 20px; height: 20px;margin-right: 10px;">
                <h2 class="text-lg font-semibold text-gray-800">我的活动</h2>
              </div>
              <router-link 
                to="/certificateAuthority/activity" 
                class="text-blue-500 hover:text-blue-700 text-sm flex items-center"
              >
                查看更多 <el-icon class="w-4 h-4 ml-1"><ArrowRight /></el-icon>
              </router-link>
            </div>
            <div class="p-5">
              <div class="flex flex-col gap-1 p-3 hover:bg-gray-50 rounded-lg">
                <h3 class="font-medium text-gray-800">技术分享大会</h3>
                <div class="flex flex-wrap gap-2 mt-1 mb-2">
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">演讲</span>
                  <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">前端技术</span>
                </div>
                <p class="text-sm text-gray-400">2023-12-20</p>
                <p class="text-sm text-gray-500 mt-1">演讲者</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
// 原有脚本保持不变
import { 
  ArrowRight, 
  CircleCheck, 
  Calendar,
  Money,
  Trophy,
  Folder,
  Star,
  Briefcase,
  OfficeBuilding
} from '@element-plus/icons-vue'
import navigation from "../../views/navigation.vue"
import { ref, computed } from 'vue'
import { ElDialog, ElButton, ElIcon, ElProgress } from 'element-plus'

const signedInToday = ref(false)
const signInDays = ref(7)
const signInDialogVisible = ref(false)

const currentDate = computed(() => {
  const now = new Date()
  return `${now.getMonth() + 1}月${now.getDate()}日`
})

const handleSignIn = () => {
  if (!signedInToday.value) {
    signedInToday.value = true
    signInDays.value += 1
    signInDialogVisible.value = true
  }
}

const showSignRecord = () => {
  console.log('查看签到记录')
}

const goToPointsMall = () => {
  console.log('前往积分商城')
}
</script>

<style scoped>
/* 新增关闭按钮样式 */
.close-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0 12px;
  transform: translateY(-50%);
}

/* 调整header区域样式 */
:deep(.el-dialog__header) {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid #ebeef5;
}

.dialog-header {
  position: relative;
  padding-right: 30px; /* 给关闭按钮留出空间 */
}

/* 弹窗自定义样式 */
.signin-dialog {
  border-radius: 12px;
}

.signin-dialog :deep(.el-dialog__header) {
  padding-bottom: 0;
  margin-right: 0;
}

.signin-dialog :deep(.el-dialog__body) {
  padding: 0 20px;
}

/* 其他原有样式保持不变... */
.signin-dialog {
  border-radius: 12px;
}

.signin-dialog :deep(.el-dialog__body) {
  padding: 0 20px;
}
.hover\:bg-gray-50:hover {
  transition: background-color 0.2s ease;
}

.hover\:shadow-md:hover {
  transition: box-shadow 0.3s ease;
}

.router-link-active {
  text-decoration: none;
}

.border-gray-100:hover {
  transform: translateY(-2px);
  transition: transform 0.3s ease;
}

.hover\:from-blue-200:hover {
  transition: background 0.3s ease;
}
.hover\:to-blue-100:hover {
  transition: background 0.3s ease;
}

/* 确保底部对齐 */
.grid > div {
  display: flex;
  flex-direction: column;
}

.grid > div > div:last-child {
  flex-grow: 1;
}
</style>